<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en" class="fly-html-layui fly-html-store">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/layui/dist/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/css/global.css" charset="utf-8">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/css/global(1).css" charset="utf-8">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/css/store.css" charset="utf-8">
    <link rel="icon" href="${pageContext.request.contextPath}/front/images/favicon.ico">
    <title>酒店管理系统</title>
<body>
<!-- 顶部start -->
<div class="layui-header header header-store" style="background-color: #393D49;">
    <div class="layui-container">
        <a class="logo" href="${pageContext.request.contextPath}/index.html">
            <img src="${pageContext.request.contextPath}/front/images/logo.png" alt="layui">
        </a>
        <div class="layui-form component" lay-filter="LAY-site-header-component"></div>
        <ul class="layui-nav" id="layui-nav-userinfo">
            <li data-id="index" class="layui-nav-item layui-hide-xs">
                <a class="flytoTopNav" href="${pageContext.request.contextPath}/index.html">首页</a>
            </li>
            <li data-id="room" class="layui-nav-item layui-hide-xs">
                <a class="fly-case-active" data-type="toTopNav" href="${pageContext.request.contextPath}/room/list.html">房间</a>
            </li>
            <li data-id="myInfo" class="layui-nav-item fly-layui-user layui-this" id="FLY-notice">
                <a class="fly-nav-avatar fly-case-active" data-type="toTopNav" href="${pageContext.request.contextPath}/userinfo.jsp" id="LAY_header_avatar">
                    <img src="${pageContext.request.contextPath}/imgs/head.jpg"><cite class="layui-hide-xs">欢迎您：${sessionScope.currentUser.loginName}</cite>
                </a>
            </li>
            <li class="layui-nav-item layui-hide-xs">
                <a class="fly-case-active" data-type="exitSystem" href="JavaScript:void(0);" id="logout">退出</a>
            </li>
            <span class="layui-nav-bar" style="left: 560px; top: 55px; width: 0px; opacity: 0;"></span>
        </ul>
    </div>
</div>
<!-- 顶部end -->

<!-- 中间区域开始 -->
<div class="shop-nav shop-index">
    <div class="shop-banner" style="background: #f2f2f2;">
        <div class="layui-container layui-hide-xs">
            <!--会员菜单 start-->
            <div class="product-list">
                <dl>
                    <dt style="background-color: #009688">会员中心</dt>
                    <dd><a href="${pageContext.request.contextPath}/userinfo.jsp">个人信息</a></dd>
                    <dd class="activate"><a href="${pageContext.request.contextPath}/userOrder.jsp">我的预定</a></dd>
                </dl>
            </div>
            <!--会员菜单 end-->
        </div>
        <div class="layui-container">
            <div class="fly-panel fly-panel-user" pad20="">
                <div class="layui-tab layui-tab-brief" lay-filter="user">
                    <ul class="layui-tab-title" id="LAY_mine">
                        <li class="layui-this" lay-id="info">我的预定</li>
                    </ul>
                    <div class="layui-tab-content" style="padding: 20px 0;    height: 385px;">
                        <table id="tenantOrder" lay-filter="tenantOrder"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 中间区域结束 -->
<!-- 底部 -->
<div class="fly-footer">
    <p><a href="#">酒店系统</a> 2022 © <a href="#">test.cn</a></p>
</div>
<!-- 脚本开始 -->
<script src="${pageContext.request.contextPath}/front/layui/dist/layui.js"></script>
<script>
    layui.use(["form","element","carousel", 'table', 'laydate', 'jquery', 'layer'], function () {
        var form = layui.form,
            layer = layui.layer,
            element = layui.element,
            carousel = layui.carousel,
            $ = layui.jquery,
            table = layui.table;

        //渲染轮播图
        carousel.render({
            elem: '#LAY-store-banner'
            ,width: '100%' //设置容器宽度
            ,height: '460' //设置容器高度
            ,arrow: 'always' //始终显示箭头
        });

        //渲染表格组件
        var tableIns = table.render({
            elem: '#tenantOrder',
            url: '${pageContext.request.contextPath}/orders/list',
            cols: [[
                {field: 'id', title: '序号', align: "center"},
                {field: 'ordersNo', title: '订单号', align: "center"},
                {field: 'roomId', title: '房间号', align: "center",templet:function (d) {
                    return d.room.roomNum;
                }},
                {field: 'reservePrice', title: '总金额', align: "center"},
                {field: 'status', title: '订单状态', align: "center",templet:function (d) {
                    if(d.status==1){
                        return "待确认";
                    }else if(d.status==2){
                        return "已确认";
                    }else if(d.status==3){
                        return "已入住";
                    }else{
                        return "已完成";
                    }
                }},
                {field: 'arriveDate', title: '入住时间', align: "center"},
                {field: 'leaveDate', title: '退房时间', align: "center"}
            ]],
            page: true,
            done: function (res, curr, count) {
                //判断当前页码是否是大于1并且当前页的数据量为0
                if (curr > 1 && res.data.length == 0) {
                    var pageValue = curr - 1;
                    //刷新数据表格的数据
                    tableIns.reload({
                        page: {curr: pageValue}
                    });
                }
            }
        });

        $('#logout').on("click", function () {
            layer.confirm('确定要退出系统吗?', {icon: 3, title:'提示'}, function(index){
                //do something
                location.href="${pageContext.request.contextPath}/user/logout";
                layer.close(index);
            });
        });

    });
</script>
<!-- 脚本结束 -->
<ul class="layui-fixbar">
    <li class="layui-icon layui-fixbar-top" lay-type="top" style=""></li>
</ul>
<div class="layui-layer-move"></div>
</body>
</html>